package com.rabbitmq.topicdemo.lstener;

import com.rabbitmq.topicdemo.config.TopicConfig;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

//需要被spring容器管理
@Component
public class TopicListener01 {
    @RabbitListener(queues = TopicConfig.TOPIC_QUEUE+"_pay")
    public void getPayMessage(Map<String,String> message){
        String phone=message.get("phone");
        String nickname=message.get("nickname");
        String v=message.get("appV");
        System.out.println("APP"+v+"用户："+nickname+"支付成功");
    }
    @RabbitListener(queues = TopicConfig.TOPIC_QUEUE+"_insert")
    public void getInsertMessage(Map<String,String> message){
        String phone=message.get("phone");
        String nickname=message.get("nickname");
        String v=message.get("appV");
        System.out.println("APP"+v+"用户："+nickname+"订单创建成功");
    }

    @RabbitListener(queues = TopicConfig.TOPIC_QUEUE+"_msg")
    public void getSedMessage(Map<String,String> message){
        String phone=message.get("phone");
        String nickname=message.get("nickname");
        String v=message.get("appV");
        System.out.println("APP"+v+"用户："+nickname+"开通会员成功 , 发送至手机号："+phone);
    }


}
